package cn.wolfcode.MyEnum;

import lombok.Getter;

@Getter
public enum VoteEnum {
    SINGLE("单选", 0),
    MORE("多选", 1),
    RESTS("其他", 2);


    private String name;
    private Integer value;

    VoteEnum(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    //提供一个根据value 获取名字的方法
    public static String findName(Integer value) {
        VoteEnum[] values = VoteEnum.values();
        for (VoteEnum a :
                values) {
            if (a.getValue().equals(value)) {
                return a.getName();
            }
        }
        return null;
    }
}
